#include "MemoryPCH.h"

#include "MM_MemoryObject.h"
#include "MM_MemoryAllocator.h"

using namespace Memory;

//------------------------------------------------------------------------------------
//MM_MemoryObject
//------------------------------------------------------------------------------------
template <class Allocator,MM_MemoryPoolType MemoryPool>
void* MM_MemoryObject<Allocator,MemoryPool >::operator new(size_t sz)
{
	return Allocator::Allocate( sz,MemoryPool );
}
//------------------------------------------------------------------------------------
template <class Allocator,MM_MemoryPoolType MemoryPool>
void* MM_MemoryObject<Allocator,MemoryPool >::operator new[] ( size_t sz )
{
	return Allocator::Allocate(sz,MemoryPool);
}
//------------------------------------------------------------------------------------
template <class Allocator,MM_MemoryPoolType MemoryPool>
void* MM_MemoryObject<Allocator,MemoryPool >::operator new(size_t sz, void* ptr)
{
	return Allocator::Realocate(ptr,sz,MemoryPool);
}
//------------------------------------------------------------------------------------
template <class Allocator,MM_MemoryPoolType MemoryPool>
void* MM_MemoryObject<Allocator,MemoryPool >::operator new(size_t sz, const char* file, int line, const char* func)
{
	return Allocator::Allocate(sz,MemoryPool, file, line, func);
}
//------------------------------------------------------------------------------------
template <class Allocator,MM_MemoryPoolType MemoryPool>
void* MM_MemoryObject<Allocator,MemoryPool >::operator new[] ( size_t sz, const char* file, int line, const char* func )
{
	return Allocator::Allocate(sz,MemoryPool, file, line, func);
}
//------------------------------------------------------------------------------------
template <class Allocator,MM_MemoryPoolType MemoryPool>
void* MM_MemoryObject<Allocator,MemoryPool >::operator new(size_t sz, void* ptr,const char* file, int line, const char* func)
{
	return Allocator::Realocate(ptr,sz,MemoryPool,file,line,func);
}
//------------------------------------------------------------------------------------
template <class Allocator,MM_MemoryPoolType MemoryPool>
void MM_MemoryObject<Allocator,MemoryPool >::operator delete( void* ptr , void* )
{
	Allocator::Deallocate(ptr);
}
//------------------------------------------------------------------------------------
template <class Allocator,MM_MemoryPoolType MemoryPool>
void MM_MemoryObject<Allocator,MemoryPool >::operator delete[] ( void* ptr )
{
	Allocator::Deallocate(ptr);
}
//------------------------------------------------------------------------------------
template <class Allocator,MM_MemoryPoolType MemoryPool>
void MM_MemoryObject<Allocator,MemoryPool >::operator delete( void* ptr , size_t sz )
{
	Allocator::Deallocate(ptr);
}
//------------------------------------------------------------------------------------
template <class Allocator,MM_MemoryPoolType MemoryPool>
void MM_MemoryObject<Allocator,MemoryPool >::operator delete[]( void* ptr , size_t sz )
{
	Allocator::Deallocate(ptr);
}
//------------------------------------------------------------------------------------
template <class Allocator,MM_MemoryPoolType MemoryPool>
void MM_MemoryObject<Allocator,MemoryPool >::operator delete( void* ptr , const char* , int , const char*   )
{
	Allocator::Deallocate(ptr);
}
//------------------------------------------------------------------------------------
template <class Allocator,MM_MemoryPoolType MemoryPool>
void MM_MemoryObject<Allocator,MemoryPool >::operator delete[]( void* ptr , const char* , int , const char*  )
{
	Allocator::Deallocate(ptr);
}

template class MM_MemoryObject<MM_StandMemoryAllocator,MPT_DEFAULT>;